<template>
  <div class="shadow course" :style="{width: width}">
    <div class="img" :style="{backgroundImage: `url(${course.show_tpdz})`}"></div>
    <div class="info">
        <h2>{{ course.name }}</h2>
        <div class="teacher small">授课教师：{{ course.lecturer }}</div>
    </div>
    <div class="btns">
        <div class=" small">开始学习</div>
        <div class=" small">时长：{{ course.duration }}</div>
        <div class=" small">课时：{{ course.lesson }}</div>
    </div>
  </div>
</template>

<script>
export default {
    props: {
        course: {
            type: Object,
            require: true,
            default:() => {
                return {}
            }
        },
        width: {
            type: String,
            require: false,
            default: '275px'
        }
    },
    data() {
        return {
            
        }
    }
}
</script>

<style lang="scss" scoped>
.course {
    transition: all .2s;
    cursor: pointer;
    // &:not(:nth-of-type(4n)) {
    //     margin-right: 20px;
    // }
    &:hover {
        transform: translateY(-10px);
    }
    .img {
        height: 137px;
        background-position: center center;
        background-repeat: no-repeat;
        background-size: cover;
    }
    .info {
        padding: 15px;
        text-align: left;
        h2 {
            font-weight: 600;
            height: 40px;
        }
        .teacher {
            line-height: 27px;
        }
    }
    .btns {
        padding: 0 20px;
        margin-bottom: 15px;
        position: relative;
        height: 30px;
        div {
            position: absolute;
            bottom: 0;
            color: #fff;
            border-radius: 5px;
            &:first-of-type {
                left: 20px;
                padding: 5px 7px;
                background: var(--color-primary);
                cursor: pointer;
            }
            &:not(:first-of-type) {
                padding: 2px;
                background: #ff5500;
            }
            &:nth-of-type(2) {
                left: 100px;
            }
            &:last-of-type {
                left: 200px;
            }
        }
    }
}
</style>